package cn.exrick.xboot.modules.account.controller;

import cn.exrick.xboot.common.utils.ResultUtil;
import cn.exrick.xboot.common.vo.Result;
import cn.exrick.xboot.modules.account.entity.Account;
import cn.exrick.xboot.modules.account.service.AccountService;
import com.baomidou.dynamic.datasource.annotation.DS;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedList;
import java.util.List;


@Slf4j
@RestController
@DS("other")
@Api(tags = "财务信息管理接口")
@RequestMapping("/xboot/account")
@Transactional
public class AccountController {
    @Autowired
   private AccountService accountService;

    @RequestMapping(value = "/getAccountByYear", method = RequestMethod.GET)
    @ApiOperation(value = "财务大屏总数据--本年")
    public Result getAccountByYear(){
       Account account = accountService.getAccountByYear();
        return new ResultUtil<Account>().setData(account);
    }

    @RequestMapping(value = "/getAccountByMonth", method = RequestMethod.GET)
    @ApiOperation(value = "财务大屏总数据--本月")
    public Result getAccountByMonth(){
        Account account = accountService.getAccountByMonth();
        return new ResultUtil<Account>().setData(account);
    }

    @RequestMapping(value = "/getXJLROrder", method = RequestMethod.GET)
    @ApiOperation(value = "现金流流入排行--本年")
    public Result getXJLROrderByYear(){
        List<Account> account = accountService.getXJLROrderByYear();
        return new ResultUtil<List<Account>>().setData(account);
    }

    @RequestMapping(value = "/getXJLROrderByMonth", method = RequestMethod.GET)
    @ApiOperation(value = "现金流流入排行--本月")
    public Result getXJLROrderByMonth(){
        List<Account> account = accountService.getXJLROrderByMonth();
        return new ResultUtil<List<Account>>().setData(account);
    }

    @RequestMapping(value = "/getYSZKOrder", method = RequestMethod.GET)
    @ApiOperation(value = "应收账款排行--本年")
    public Result getYSZKOrder(){
        List<Account> account = accountService.getYSZKOrder();
        return new ResultUtil<List<Account>>().setData(account);
    }

    @RequestMapping(value = "/getYSZKOrderByMonth", method = RequestMethod.GET)
    @ApiOperation(value = "应收账款排行--本月")
    public Result getYSZKOrderByMonth(){
        List<Account> account = accountService.getYSZKOrderByMonth();
        return new ResultUtil<List<Account>>().setData(account);
    }

    @RequestMapping(value = "/getSPKPOrder", method = RequestMethod.GET)
    @ApiOperation(value = "收票开票排行--本年")
    public Result getSPKPOrder(){
        List<Account> account = accountService.getSPKPOrder();
        return new ResultUtil<List<Account>>().setData(account);
    }

    @RequestMapping(value = "/getSPKPOrderByMonth", method = RequestMethod.GET)
    @ApiOperation(value = "收票开票排行--本月")
    public Result getSPKPOrderByMonth(){
        List<Account> account = accountService.getSPKPOrderByMonth();
        return new ResultUtil<List<Account>>().setData(account);
    }

    @RequestMapping(value = "/getSRQROrder", method = RequestMethod.GET)
    @ApiOperation(value = "收入确认排行--本年")
    public Result getSRQROrder(){
        List<Account> account = accountService.getSRQROrder();
        return new ResultUtil<List<Account>>().setData(account);
    }

    @RequestMapping(value = "/getSRQROrderByMonth", method = RequestMethod.GET)
    @ApiOperation(value = "收入确认排行--本月")
    public Result getSRQROrderByMonth(){
        List<Account> account = accountService.getSRQROrderByMonth();
        return new ResultUtil<List<Account>>().setData(account);
    }

    @RequestMapping(value = "/getContractMoney", method = RequestMethod.GET)
    @ApiOperation(value = "合同签订金额排行--本年")
    public Result getContractMoney(){
        List<Account> account = accountService.getContractMoney();
        return new ResultUtil<List<Account>>().setData(account);
    }

    @RequestMapping(value = "/getContractMoneyByMonth", method = RequestMethod.GET)
    @ApiOperation(value = "合同签订金额排行--本月")
    public Result getContractMoneyByMonth(){
        List<Account> account = accountService.getContractMoneyByMonth();
        return new ResultUtil<List<Account>>().setData(account);
    }

    @RequestMapping(value = "/getXJLLine", method = RequestMethod.GET)
    @ApiOperation(value = "获取柱状图本年--现金流情况")
    public Result getXJLLine(){
        LinkedList<Object> account = accountService.getXJLLine();
        return new ResultUtil<LinkedList<Object>>().setData(account);
    }

    @RequestMapping(value = "/getXJLLineByMonth", method = RequestMethod.GET)
    @ApiOperation(value = "获取柱状图本月--现金流情况")
    public Result getXJLLineByMonth(){
        LinkedList<Object> account = accountService.getXJLLineByMonth();
        return new ResultUtil<LinkedList<Object>>().setData(account);
    }

    @RequestMapping(value = "/getContractInfoLine", method = RequestMethod.GET)
    @ApiOperation(value = "合同签订情况--柱状折线图--本年")
    public Result getContractInfoLine(){
        LinkedList<Object> account = accountService.getContractInfoLine();
        return new ResultUtil<LinkedList<Object>>().setData(account);
    }

    @RequestMapping(value = "/getContractInfoLineByMonth", method = RequestMethod.GET)
    @ApiOperation(value = "合同签订情况--柱状折线图--本月")
    public Result getContractInfoLineByMonth(){
        LinkedList<Object> account = accountService.getContractInfoLineByMonth();
        return new ResultUtil<LinkedList<Object>>().setData(account);
    }

    @RequestMapping(value = "/getXJLInfoByTime", method = RequestMethod.GET)
    @ApiOperation(value = "现金流情况--折线图-按照时间")
    public Result getXJLInfoByTime(){
        LinkedList<Object> account = accountService.getXJLInfoByTime();
        return new ResultUtil<LinkedList<Object>>().setData(account);
    }



    @RequestMapping(value = "/getDeptInfo", method = RequestMethod.GET)
    @ApiOperation(value = "二级菜单--获取全部")
    public Result getDeptInfo(Account account6){
        List<Account> account = accountService.getDeptInfo(account6);
        return new ResultUtil<List<Account>>().setData(account);
    }

    @RequestMapping(value = "/getDeptInfoByMonth", method = RequestMethod.GET)
    @ApiOperation(value = "二级菜单--获取全部--本月")
    public Result getDeptInfoByMonth(Account account6){
        List<Account> account = accountService.getDeptInfoByMonth(account6);
        return new ResultUtil<List<Account>>().setData(account);
    }
}
